import request from '@/utils/request'
/**
 * 保存
 * @param {*} data
 * @returns
 */
export function archiveSave(data) {
  data.schedule = 'A'
  return request({
    url: '/api/v1/ctmCustomerChange/createOrSubmit/info',
    method: 'POST',
    data
  })
}
/**
 * 提交
 * @param {*} data
 * @returns
 */
export function archiveSubmit(data) {
  data.schedule = 'B'
  return request({
    url: '/api/v1/ctmCustomerChange/createOrSubmit/info',
    method: 'POST',
    data
  })
}
/**
 * 详情
 * @param {*} id
 * @returns
 */
export function archiveDetail(id) {
  return request({
    url: `/api/v1/ctmCustomerChange/detail/info/${id}`,
    method: 'GET'
  })
}
/**
 * 获取指定门店数据
 * @param {*} customerCode 
 * @param {*} shopCode 
 * @returns 
 */
export function getShopData(customerCode, shopCode) {
  return request({
    url: `/api/v1/ctmCustomerShopFiles/queryByCustomerCode/${customerCode}`,
    method: 'GET'
  }).then(res => {
    return res.data.find(e => e.code === shopCode)
  })
}
/**
 * 获取所有门店
 * @param {*} customerCode 
 * @returns 
 */
export function getAllShopData(customerCode) {
  return request({
    url: `/api/v1/ctmCustomerShopFiles/queryByCustomerCode/${customerCode}`,
    method: 'GET'
  })
}